import 'package:flutter_base/21_getx/counter2Controller.dart';
import 'package:flutter_base/21_getx/counterController.dart';
import 'package:get/get.dart';
import 'package:flutter/material.dart';

class GetFrist extends StatefulWidget {
  const GetFrist({super.key});

  @override
  State<GetFrist> createState() => _GetFristState();
}

class _GetFristState extends State<GetFrist> {
  // CounterController counterController = Get.put(CounterController());
  CounterController counterController = Get.find<CounterController>();
  Counter2Controller counter2controller = Get.find();
  @override
  void initState() {
    // TODO: implement initState
    super.initState();
    print('第一个界面----------------');
    print(Get.arguments);
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: const Text('这是GetFrist  11111'),
        ),
        body: Column(
          children: [
            ElevatedButton(
                onPressed: () {
                  /// 命名路由跳转
                  Get.toNamed('/second', arguments: {'11': '33'});
                  // Get.off(page)
                },
                child: const Text('注册1')),
            ElevatedButton(
                onPressed: () {
                  counterController.count.value++;
                  counter2controller.str.value = 'rose';
                },
                child: const Text('增加+++')),
            Obx(() => Text('${counterController.count.value}')),
            Obx(() => Text(counter2controller.str.value)),
          ],
        ));
  }
}
